package com.tczs.web.config;

import com.tczs.dispatch.CollectAction;
import com.tczs.dispatch.Handler;
import com.tczs.server.request.ServerRequestModel;
import com.tczs.web.util.JWTUtil;
import java.lang.reflect.Method;

public class LoginIntercept {

    public static void  checkLogin(ServerRequestModel serverRequestModel){
        Handler handler =  CollectAction.handlers.get(serverRequestModel.getUrl());
        Method method = handler.getMethod();
        if(method.isAnnotationPresent(NeedLogin.class)){
            String token = serverRequestModel.getToken();
            JWTUtil.vaildToken(token);
        }
    }

}
